@extends('admin.layouts.main')
@section('header')
    @parent
@endsection
@section('content')
    <form class="layui-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">账号</label>
                <div class="layui-input-inline">
                    <input type="search" class="layui-input" name="account" placeholder="账号" disabled>
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">昵称</label>
                <div class="layui-input-inline">
                    <input type="search" class="layui-input" name="nickname" placeholder="昵称" lay-verify="required">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                    <input type="password" class="layui-input" name="password" placeholder="密码,不填写则不修改">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-inline">
                    <input type="password" class="layui-input" name="re_password" placeholder="确认密码">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="sex" value="1"  title="男">
                    <input type="radio" name="sex" value="2"  title="女">
                    <input type="radio" name="sex" value="0" title="保密">
                </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-inline">
                    <input type="radio" name="status" value="1" title="正常">
                    <input type="radio" name="status" value="0"  title="禁用">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input type="hidden" name="id" value="">
                <button class="layui-btn layui-btn-sm" lay-submit="" lay-filter="submit">立即提交</button>
            </div>
        </div>
    </form>
@endsection
@section('footer')
    @parent
    <script type="text/javascript">
       layui.use(['layer','jquery','form'],function () {
           var layer = layui.layer,
               $ = layui.jquery,
               form = layui.form;
           form.on("submit(submit)",function (data) {
               var formData = data.field;
                goConfirm('{{ url('admin/user/edit') }}',formData,'确认提交数据',1);
               return false;
           });
           getInfo();
           function getInfo() {
               var id = getUrlParam('id');
               $.get('{{ url('admin/user/detail') }}',{id:id},function (res) {
                   if(res.status == 200){
                       var data = res.data;
                       $('input[name="id"]').val(id);
                       $('input[name="account"]').val(data.account);
                       $('input[name="nickname"]').val(data.nickname);
                       $('input[name="sex"][value="'+data.sex+'"]').attr('checked',true);
                       $('input[name="status"][value="'+data.status+'"]').attr('checked',true);
                       form.render();
                   }
               },'json')
           }
       });



    </script>
@endsection